﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinFormsApp3
{
    internal class clock {
        //设置闹钟时间
        public string TimeHour { get; set; }
        public string TimeMinute { get; set; }
        public static int hour = 0;
        public static int minute = 0;
        

        //判断时间是否正确
        public void IsTimeOk(string h,string m)
        {
            if (h.Length != 2 || m.Length != 2)
            {
                throw new TimeFormatErrorException("输入的时间格式不正确，请重新输入！");
            }
            hour = Convert.ToInt32(h);
            minute= Convert.ToInt32(m);

            if (hour < 0 || hour > 24 || minute < 0 || minute > 60)
             {
                throw new TimeInputErrorException("输入的时间不正确，请重新输入！");
            }
        }

    }
}
